package io.github.talelin.latticy.controller.zty;

import io.github.talelin.core.annotation.LoginRequired;
import io.github.talelin.latticy.service.OutputListService;
import io.github.talelin.latticy.vo.zty.OutputDetailVO;
import io.github.talelin.latticy.vo.zty.OutputListVO;
import io.github.talelin.latticy.vo.zty.ReplenishDetailVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.Positive;
import java.util.List;

@RestController
@RequestMapping("/output")
public class OutputController {

    @Autowired
    OutputListService outputListService;
    @GetMapping("/outputList")
    @LoginRequired
    public List<OutputListVO> getOutputList(){
        List<OutputListVO> outputLists = outputListService.getOutputLists();
        return outputLists;
    }


    @GetMapping("/details/{id}")
    @LoginRequired
    public List<OutputDetailVO>  getReplenishApplyDetailById(@PathVariable(value = "id") @Positive(message = "{id.positive}") Integer id){
        System.out.println(id);
        List<OutputDetailVO> outputDetailVOs = outputListService.getOutputDetailsByListId(id);
        return outputDetailVOs;
    }
}
